import {
	mapMutations
} from 'vuex'
export default {
	...mapMutations([
		'upUserInfo'
	]),
	selectTime(index){
		this.timeCurrent = index
		this.page = 1
		this.list = []
		this.getPageList()
	},
	//他的圈子
	tohisCircle(id){
		uni.navigateTo({
			url: '/pages/my/hisCircle?id='+id
		})
	},
	//请求好友
	tofriendRequest(id){
		uni.navigateTo({
			url: '/pages/index/friendRequest?userId='+id
		})
	},
	//换一换
	changePage(){
		this.getPageList()
	},
	//重置
	reset(){
		this.page = 1
		this.list = []
		this.getPageList()
	},
	//获取我的影子列表
	getPageList() {
		let that = this
		if (that.loading) {
			return false
		}
		that.loading = true
		that.$httpRequest.get({
			that: that,
			url: 'h5/getMyShadowPage',
			params: {
				shadowType:that.timeCurrent,
				pageNo: that.page,
				pageSize: that.list_rows,
			},
			success: res => {
				that.loading = false
				if (res.code === that.$httpConfig.SUCCESS_CODE) {
					that.list = res.data.rows
					// if (that.page === 1) {
					// 	that.list = res.data.rows
					// } else {
					// 	that.list = that.list.concat(res.data.rows)
					// }
					that.page++
				} else {
					
				}
			}
		})
	},
	getUserInfo() {
		let that = this
		that.$httpRequest.get({
			that: that,
			url: 'h5/info',
			params: {
	
			},
			success: res => {
				if (res.code === that.$httpConfig.SUCCESS_CODE) {
					that.upUserInfo(res.data)
				} else {
					that.upUserInfo({})
				}
			}
		})
	},

	toSetUserInfo(){
		uni.navigateTo({
			url: '/pages/my/setUserInfo'
		})
	},



}
